<?php

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class MenuSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        // 添加后台管理导航栏目
        $date        = date('Y-m-d H:i:s');
        $intParentId = DB::table('menus')->insertGetId([
            'name'       => '前台管理',
            'url'        => '#',
            'icon'       => 'fa-desktop',
            'parent'     => 0,
            'sort'       => 101,
            'created_at' => $date,
            'updated_at' => $date,
        ]);

        // 新增导航
        $intNavParentId = DB::table('menus')->insertGetId([
            'name'       => '导航管理',
            'url'        => '#',
            'icon'       => 'fa-list',
            'parent'     => $intParentId,
            'sort'       => 1,
            'created_at' => $date,
            'updated_at' => $date,
        ]);

        DB::table('menus')->insert([
            [
                'name'       => '分类列表',
                'url'        => '/admin/nav/nav-types/index',
                'icon'       => 'fa-indent',
                'parent'     => $intNavParentId,
                'created_at' => $date,
                'updated_at' => $date
            ],
            [
                'name'       => '导航栏目',
                'url'        => '/admin/nav/nav/index',
                'icon'       => 'fa-list',
                'parent'     => $intNavParentId,
                'created_at' => $date,
                'updated_at' => $date
            ],
        ]);

        $intSlideParentId = DB::table('menus')->insertGetId([
            'name'       => '幻灯片管理',
            'url'        => '#',
            'icon'       => 'fa-picture-o',
            'parent'     => $intParentId,
            'sort'       => 1,
            'created_at' => $date,
            'updated_at' => $date,
        ]);

        DB::table('menus')->insert([
            [
                'name'       => '分类列表',
                'url'        => '/admin/slide/slide-types/index',
                'icon'       => 'fa-indent',
                'parent'     => $intSlideParentId,
                'created_at' => $date,
                'updated_at' => $date
            ],
            [
                'name'       => '幻灯片',
                'url'        => '/admin/slide/slide/index',
                'icon'       => 'fa-picture-o',
                'parent'     => $intSlideParentId,
                'created_at' => $date,
                'updated_at' => $date
            ],
        ]);
    }
}